package com.baidu.camera.utils;

import java.io.File;
import java.io.IOException;

/**
 * Created by JGW-android on 2016/3/4.
 */
public class FileUtils {

    //create a file
    public static File createFile(String path, String fileName) {
        File f = new File(path);
        if (!f.exists()) {
            f.mkdirs();
        }
        File ff = new File(f, fileName);
        if (!ff.exists()) {
            try {
                ff.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return ff;
    }

    public static File createImageFile(String path) {
        return createFile(path, (int) (Math.random() * 10000) + ".png");
    }
}
